')
.attr('data-levelId', node.levelId)
.attr('data-visibleChilds', 'true')
.attr('data-model_id', node.model_id)
.attr('data-isAGoal', node.isAGoal)
.attr('data-object_id', node.object_id)
.attr('data-lastValue', lastValue)
.append(
$('' + _getSpaces() + (node.nodes!=null && node.nodes.length!=0?' ':' ') + ' ' + node.text + ' ')
.click(function(){
if(node.nodes == null || node.nodes.length == 0)
return;
if($(this.parentNode).attr('data-visibleChilds') == 'true'){
ret.find('tr[data-levelId ^= "'+node.levelId+'-"]').hide();
$(this).parent().attr('data-visibleChilds', 'false');
} else {
ret.find('tr[data-levelId ^= "'+node.levelId+'-"]').show();
$(this).parent().attr('data-visibleChilds', 'true');
var firstSpan = ret.find('tr[data-levelId ^= "'+node.levelId+'-"]').find('span').first();
if(firstSpan.hasClass('glyphicon-chevron-right')){
firstSpan.removeClass('glyphicon-chevron-right');
firstSpan.addClass('glyphicon-chevron-down');
}
}
$(this).find('span').first().toggleClass('glyphicon-chevron-right');
$(this).find('span').first().toggleClass('glyphicon-chevron-down');
})
).append(
$(''+valueToDisplay+' ').popover({
placement : 'auto right',
container : 'body',
html : true,
title : node.text + ' details',
content : function(){
var html = ''+node.description+'
';
if(objInfo == null)
return html;
if(errorMsg != null){
html += 'Error Occurred: '+errorMsg+'
';
return html;
}
if(measure==null)
throw 'Unexpected Exception!';
if(node.isAGoal){
html += '';
html += 'Details Values ';
html += 'status '+(measure.status==0?'UNKNOWN':(measure.status>0?'SUCCESS':'FAILURE'))+' ';
if(objInfo.type!=null)
html += 'type '+objInfo.type+' ';
for(var moreInfoKey in measure.moreInfo)
html += ''+moreInfoKey+' '+measure.moreInfo[moreInfoKey]+' ';
html += '
';
} else {
html += '';
html += '';
measure.columns.forEach(function(item){
html += ''+item+' ';
});
html += ' ';
measure.data.forEach(function(dataItem, index){
if(index > 10)
return;
html += '';
measure.columns.forEach(function(columnName){
html += '' + (dataItem[columnName]!=null?dataItem[columnName] + ' ' + objInfo.getFieldInfos(columnName).measureUnit :'') + ' ';
});
html += ' ';
});
if(measure.data.length > 10){
html += '';
measure.columns.forEach(function(item, i){
html += ''+(i==0?'...':'')+' ';
});
html += ' ';
}
if(measure.data.length == 0){
html += 'No information available ';
}
html += '
';
html += 'More informations:
';
html += '';
for(var moreInfoKey in measure.moreInfo)
html += ''+moreInfoKey+' '+measure.moreInfo[moreInfoKey]+' ';
if(Object.keys(measure.moreInfo).length==0 && objInfo.type==null && Object.keys(objInfo.moreInfo).length==0)
html += 'No additional infos available ';
if(objInfo.type!=null)
html += 'type '+objInfo.type+' ';
for(var moreInfoKey in objInfo.moreInfo)
html += ''+moreInfoKey+' '+objInfo.moreInfo[moreInfoKey]+' ';
html += '
';
}
return html;
}(),
trigger : 'hover'
})
).append(
function(){
if(node.isAGoal || measure==null)
return $('');
var targetRangeStatusDom = null;
if(measure.targetRangeAlgorithmResult!=null){
var targetRangeStatus = measure.targetRangeAlgorithmResult.status;
var targetRangeStatusHtml = _createCircleCode(targetRangeStatus==null?'lightgrey':(targetRangeStatus>0?'green':(targetRangeStatus<0?'red':'grey')));
targetRangeStatusDom = $('').append($(targetRangeStatusHtml)).popover({
placement : 'auto left',
container : 'body',
html : true,
title : node.text + ' target range status additional infos',
content : function(){
var html = '
';
for(var moreInfoKey in measure.targetRangeAlgorithmResult.moreInfo)
html += ''+moreInfoKey+' '+measure.targetRangeAlgorithmResult.moreInfo[moreInfoKey]+' ';
if(Object.keys(measure.targetRangeAlgorithmResult.moreInfo).length==0)
html += 'No additional infos available ';
html += '
';
return html;
}(),
trigger : 'hover'
});
}
var alertRangeStatusDomList = [];
for(var i=0;i
').append($(alertCurrentStatusHtml)).popover({
placement : 'auto left',
container : 'body',
html : true,
title : node.text + ' alert range status additional infos',
content : function(){
var html = '';
for(var moreInfoKey in alertCurrentResult.moreInfo)
html += ''+moreInfoKey+' '+alertCurrentResult.moreInfo[moreInfoKey]+' ';
if(Object.keys(alertCurrentResult.moreInfo).length==0)
html += 'No additional infos available ';
html += '
';
return html;
}(),
trigger : 'hover'
});
alertRangeStatusDomList.push(alertCurrentStatusDom);
}
return $('').append(
targetRangeStatusDom
).append(
alertRangeStatusDomList
);
}()
));
if(node.nodes!=null)
node.nodes.forEach(function(item){
_appendRowRec(item, levelNum+1);
});
};
_appendRowRec(treeJson, 0);
return toAppend;
}())
);
Dashboard.events.onFilterBySelectionClick(function(e){
var levelId = null;
ret.find('tr').each(function(index, trDom){
var tr = $(trDom);
if(tr.attr('data-model_id') == e.modelId && tr.attr('data-isAGoal') == (e.isGoal!=null?''+e.isGoal:null) && tr.attr('data-object_id') == e.objectId)
levelId = tr.attr('data-levelId');
});
if(levelId == null)
throw 'Unexpected Error: Impossible to find the levelId';
ret.find('tr:not([data-levelId ^= "'+levelId+'"])').hide();
ret.find('tr').each(function(index, trDom){
var tr = $(trDom);
if(levelId.startsWith(tr.attr('data-levelId')))
tr.show();
});
ret.find('tr[data-levelId ^= "'+levelId+'"]').show();
});
Dashboard.events.onFilterByValuesChange(function(e){
var showSuccessGoal = e.showSuccessGoal;
var showFailureGoal = e.showFailureGoal;
var showUnknownGoal = e.showUnknownGoal;
var minKpiVal = e.minKpiVal;
var sameKpiVal = e.sameKpiVal;
var maxKpiVal = e.maxKpiVal;
ret.find('tr').each(function(index, trDom){
var tr = $(trDom);
if(tr.attr('data-model_id')==null || tr.attr('data-isAGoal')==null || tr.attr('data-object_id')==null)
tr.show();
else {
if(tr.attr('data-isAGoal')=='true'){
tr.hide();
if(showSuccessGoal && tr.attr('data-lastValue') > 0)
tr.show();
if(showFailureGoal && tr.attr('data-lastValue') < 0)
tr.show();
if(showUnknownGoal && tr.attr('data-lastValue') == 0)
tr.show();
} else {
tr.show();
if(minKpiVal != '' && !(tr.attr('data-lastValue') > minKpiVal))
tr.hide();
if(sameKpiVal != '' && !(tr.attr('data-lastValue') == sameKpiVal))
tr.hide();
if(maxKpiVal != '' && !(tr.attr('data-lastValue') < maxKpiVal))
tr.hide();
}
}
});
});
return ret;
},
getConfiguration : function(){
return {
hyerarchicalView : {
description : {
en : '',
de : ''
},
value : ''
}
};
},
createConfiguration : function(presetConfig){
var node = $(' Hyerarchical Model View
');
if(presetConfig != null)
if(presetConfig.hyerarchicalView!=null)
node.find('#selectionTypeChk').prop('checked', (presetConfig.hyerarchicalView.value=='true'));
var okHandler = function(){
var hyerarchicalView = node.find('#selectionTypeChk').is(':checked');
return {
hyerarchicalView : {value : ''+hyerarchicalView}
}
};
return {
nodeElement : node,
okHandler : okHandler
};
},
getPreferredSize : function(){
return {w:10, h:10};
}
});